package com.itheima.controller.oss;


import com.itheima.vo.domain.AjaxResult;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;


/**
 * Oss对象存储管理Controller
 *
 */
@RestController
@RequestMapping("/aliyun/oss")
public class OssController {

    @PostMapping("/upload")
    private AjaxResult upload(@RequestParam(value = "photoFile") MultipartFile photoFile) throws IOException {
        String file = AliyunOSSUtil.OSSUploadFile(photoFile);
        Map imageUrl = new HashMap();
        imageUrl.put("url",file);
        return AjaxResult.success(imageUrl);
    }

}
